<?php
ob_start();

require_once(dirname(__FILE__)."/app/config/framework.php");

$available_configs = array(
    "vademecum" => "desarrollo",
    "vademecum.doku.com.ar" => "vademecumdoku",
    "www.vademecum.doku.com.ar" => "vademecumdoku",
    "spatiavademecum.com" => "produccion",
    "www.spatiavademecum.com" => "produccion"
);

$load_config = isset($available_configs[$_SERVER['HTTP_HOST']]) ? $available_configs[$_SERVER['HTTP_HOST']] : "produccion";

Config::load($load_config);
Config::set('public_path', dirname(__FILE__));


$controller = Controller::getInstance();


/*
 * Si queremos habilitar el debug durante una sesion:
 * 
 *         Session::set("debug", true);
 *
 */

if(Session::get("debug")) {

  Inspect::view($_SERVER);

  $controller->debug(true);
  
/*
  $sl = new FileLog();

  $sl->file(dirname(__FILE__)."/app/log/apache-elvademecum-custom.log");
  $sl->error(dirname(__FILE__)."/app/log/apache-elvademecum-error.log");

  $controller->debug(true)->logger($sl);
*/
}

$controller->dispatch($_SERVER['REQUEST_URI'], $_GET, $_POST);

ob_end_flush();